<template>
  <!-- 搜索框 -->
  <Appearance class="diy-search" :item="item">
    <view class="inner" :class="item.style.searchStyle" :style="inputStyles" @click="onTargetSearch">
      <view class="search-input">
        <text class="search-icon iconfont icon-search"></text>
        <text> {{item.params.placeholder }}</text>
      </view>
    </view>
  </Appearance>
</template>

<script>
	import mixin from '../mixin'
	export default {
	mixins: [mixin],
	computed: {
		inputStyles () {
			const { textAlign, inputBorderColor } = this.item.style
			return {
				textAlign,
				border: `1px solid ${inputBorderColor}`
			}
		}
	}
  }
</script>

<style lang="scss" scoped>
  .diy-search {
    padding: 20rpx 20rpx;
    font-size: 26rpx;
  }

  .inner {
    height: 60rpx;
    background: #fff;
    overflow: hidden;

    &.radius {
      border-radius: 10rpx;
    }

    &.round {
      border-radius: 60rpx;
    }
  }

  .search-input {
    height: 60rpx;
    color: #999;
    padding: 0 20rpx;
    display: flex;
    align-items: center;

    .search-icon {
      margin-right: 8rpx;
    }
  }
</style>
